package bman.game.engine;

import java.util.ArrayList;
import java.util.List;

/**
 * For use by the GraphicsEngine. Set a TextFeed to a GraphicsEngine and the GraphicsEngine 
 * will render the texts of the TextFeed.
 * 
 * Manipulate the texts contained by the TextFeed to change the text displayed by the GrphicsEngine.
 * 
 * @author MrJacky
 *
 */
public class TextFeed
{
	List<String> textList = new ArrayList<String>();
	
	public List<String> getTexts()
	{
		return textList;
	}
	
	public int addText(String text)
	{
		textList.add(text);
		return textList.indexOf(text);
	}
	
	public int setText(int index, String newText)
	{
		if(textList.size() > index && textList.size() != 0 && index >= 0)
		{
			textList.set(index,newText);
			return index;
		}
		else
		{
			return addText(newText);
		}
	}
}
